package com.cxhc.app.api;

import com.cxhc.app.api.vo.EnterpriseVo;
import com.cxhc.common.core.controller.BaseController;
import com.cxhc.common.core.domain.R;
import com.cxhc.common.core.page.TableDataInfo;
import com.cxhc.system.domain.app.SysEnterprise;
import com.cxhc.system.service.cockpit.ISysEntService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 企业Controller
 *
 * @author Dhq
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/api/enterprise")
public class ApiEnterpriseApp extends BaseController {
    @Autowired
    private ISysEntService entService;

    /**
     * 查询企业列表
     */
    @GetMapping("/list")
    public TableDataInfo list(EnterpriseVo vo) {
        startPage();
        return getDataTable(entService.selectEnterpriseList(new SysEnterprise().setAreaID(vo.getAreaId()).setFloor(vo.getFloor()).setName(vo.getName())));
    }

    /**
     * 楼层列表
     *
     * @return
     */
    @GetMapping("/floorList/{areaId}")
    public R<List<String>> floorList(@PathVariable Long areaId) {
        return R.ok(entService.selectFloorList(areaId));
    }


}
